<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>范围分段专题图</title>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" src="../../dist/include-leaflet.js"></script>
<script type="text/javascript">
    var host = window.isLocal ? document.location.protocol + "//" + document.location.host : "http://support.supermap.com.cn:8090";
    var map, themeService, themeRange, themeParameters, themeLayer,
        url = host + "/iserver/services/map-china400/rest/maps/China";
    map = L.map('map', {
        center: [30, 84],
        maxZoom: 18,
        zoom: 3
    });
    L.supermap.tiledMapLayer(url, {noWrap: true, transparent: true}).addTo(map);
    createTheme();

    function createTheme() {
        themeService = L.supermap.themeService(url);
        var themeRangeItem1 = new SuperMap.ThemeRangeItem({
            start: 0,
            end: 500000000000,
            style: new SuperMap.ServerStyle({
                fillForeColor: new SuperMap.ServerColor(211, 255, 250),
                lineColor: new SuperMap.ServerColor(179, 209, 193),
                lineWidth: 0.1
            })
        });
        var themeRangeItem2 = new SuperMap.ThemeRangeItem({
            start: 500000000000,
            end: 1000000000000,
            style: new SuperMap.ServerStyle({
                fillForeColor: new SuperMap.ServerColor(178, 218, 199),
                lineColor: new SuperMap.ServerColor(179, 209, 193),
                lineWidth: 0.1
            })
        });
        var themeRangeItem3 = new SuperMap.ThemeRangeItem({
            start: 1000000000000,
            end: 3000000000000,
            style: new SuperMap.ServerStyle({
                fillForeColor: new SuperMap.ServerColor(58, 178, 166),
                lineColor: new SuperMap.ServerColor(179, 209, 193),
                lineWidth: 0.1
            })
        });
        themeRange = new SuperMap.ThemeRange({
            rangeExpression: "SMAREA",
            rangeMode: SuperMap.RangeMode.EQUALINTERVAL,
            items: [themeRangeItem1, themeRangeItem2, themeRangeItem3]
        });
        themeParameters = new SuperMap.ThemeParameters({
            datasetNames: ["China_Province_pg"],
            dataSourceNames: ["China"],
            joinItems: null,
            themes: [themeRange]
        });
        themeService.getThemeInfo(themeParameters, function (serviceResult) {
            var result = serviceResult.result;
            if (result && result.newResourceID) {
                themeLayer = L.supermap.tiledMapLayer(url, {
                    noWrap: true,
                    cacheEnabled: false,
                    transparent: true,
                    layersID: result.newResourceID
                }).addTo(map);
            }
        });
    }
</script>
</body>
</html>